package com.recSystem.Entity.Converters;

import com.recSystem.Entity.DO.PaperDO;
import com.recSystem.Entity.DTO.PaperDTO;
import com.recSystem.Entity.DTO.PaperDetailDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author Legolas_PRC
 * @date 2023/4/6 21:11
 **/
@Mapper
public interface PaperConverter {
    PaperConverter Instance= Mappers.getMapper(PaperConverter.class);
    @Mapping(source = "paperId",target = "paper_id")
    @Mapping(source = "updateDate",target = "update_date")
    @Mapping(target = "authors",ignore = true)
    @Mapping(target = "favorite",ignore = true)
    // 将论文对象转成论文基本信息对象
    PaperDTO paperDOToDto(PaperDO paperDO);

    @Mapping(source = "paperId",target = "paper_id")
    @Mapping(source = "updateDate",target = "update_date")
    @Mapping(source = "paperAbstract",target = "paper_abstract")
    @Mapping(source = "journalRef",target = "journal_ref")
    @Mapping(target = "authors",ignore = true)
    @Mapping(target = "favorite",ignore = true)
    @Mapping(target = "categories",ignore = true)
    // 将论文对象转成论文详情对象
    PaperDetailDTO paperDOToDetail(PaperDO paperDO);

}
